<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>Help - Phase filter</title>

    <link rel="stylesheet" href="../style.css">
</head>

<body>
<table class="header">
    <tbody>
    <tr class="header">
        <td class="header">&nbsp; Phase Filtering of stacks of interferograms (InSAR operator)</td>
        <td class="header" align="right"><a href="../general/Overview.html"><img src="../images/snap_header.jpg"
                                                                                 border="0"></a></td>
    </tr>
    </tbody>
</table>
<h3>Phase filtering of stacks of interferogram</h3>

<p>
    This operator can be used to optionally filter the stacks complex interferograms. The filtering is performed
    in order to reduce noise, e.g., for visualization or to aid the phase unwrapping. It is probably best run
    after operator Interferogram. However, the optimal place for the phase filtering in the processing chain
    depends on the specific application.
</p>

<p>
    The following filtering methods are implemented: Goldstein method ("goldstein"), and Spatial Convolution
    ("spatialconv"). Functionality to load and support user defined filters will be soon implemented.
</p>

<p>
    The basic principles of implemented complex phase filters is as follows:
    In the case of the Goldstein filtering, the interferometeric fringes become
    sharper because with filtering the peak in the spectrum (caused by the fringes) is given
    a higher relative weight.
    Method "spatial convolution" is a simple spatial convolution with a certain function acting as a
    kernel, e.g., a 3 point moving average.
    <!--Method spectral (coming soon) is a multiplication of the spectrum with the kernel specified in an operator-->
    <!--input (e.g. a spectral low pass filter (LPF)).-->
    For more details refer to the implementation section and listed references.

<h4>Operator parameters:</h4>&nbsp;&nbsp;
The following input parameters are used by this operator:
<ol>
    <li>
        <b>Filtering Method:</b> Select filtering method. Choose among goldstein method ("goldstein"),
        spatial convolution ("convolution").
        <!--or spectral filter ("spectral").-->
        Note that different methods have different parameters and corresponding levels of fine tuning.
    </li>
    <li>
        <b>Alpha:</b> (Input parameter for Goldstein method only) The Alpha parameter, is the input parameter only for
        method "goldstein". This parameter, can be understood as a "smoothness coefficient" of the filter, defining
        the effective level of filtering. The value for the alpha, must be in the range from [0, 1]. The value 0 means
        no filtering, while 1 results in the most filtering. The Alpha parameter is connected and indirectly influenced
        with the input parameters for the Filtering Kernel - a higher smoothing, gives a relative decrease to the peak,
        and thus the effect of the alpha.
    </li>
    <li>
        <b>Blocksize:</b> (Input parameter for method "goldstein" only).
        <!--and "spectral" only. -->
        It defines the size of the blocks that are filtered. The parameter must be a power of 2 value. The value for
        block-size should be large enough so that the spectrum can be estimated, and small enough that it contains a peak
        frequency (1 trend in phase).
        Recommended value for block-size is: 32 pixels.
    </li>
    <li>
        <b>Overlap:</b> Input for method "goldstein" only.
        <!--and "spectral" only. -->
        The overlap value defines half of the size of the overlap between consecutive filtering blocks and tiles, thus
        that partially the same data is used for filtering. The total overlap should be smaller than the BLOCKSIZE value.
        If the parameter is set to BLOCKSIZE/2-1 (the maximum value for this parameter) then each output pixel is
        filtered based on the spectrum that is centered around it. Not that is probably the most optimal way of
        filtering, but may well be the most time consuming
        one.
    </li>
    <li>
        <b>Filtering kernel:</b> This input parameter is for methods "goldstein" and "spatialconv" only. It defines the
        one-dimension kernel function used to perform convolution. A number of the pre-defined kernels is offered,
        while future releases will have functionality that can allow users to define their own 1D filtering kernels.
        For method GOLDSTEIN: default to kernel is [1 2 3 2 1]. This kernel is used to smooth the amplitude
        of the spectrum of the complex interferogram. The spectrum is later scaled by the smoothed spectrum to the
        power alpha.
        For method SPATIALCONV: Default is a 3 point moving average [1 1 1] convolution. The real and imaginary part
        is averaged separately this way. For more info see implementation section.
    </li>

</ol>

<h4>Source bands:</h4>&nbsp;
<!--&nbsp;-->
<p> Source Bands are stack of interferograms.</p>

<h4>Output bands:</h4>&nbsp;
<!--&nbsp;-->
<p> Output Bands are stack of phase filtered interferograms.

<h4>Implementation notes:</h4>&nbsp;
<!--&nbsp;-->
 <p><i>(More details on algorithmic implementation COMING SOON!)</i></p>

<ol>
    <!--<li>-->
        <!--SPECTRAL METHOD: This method is implemented in the similar way as the "goldstein" method - operating on small-->
        <!--data blocks with overlap. Algorithm reads data block-per-block, and on every block it performs-->
        <!--a 2D FFT operation, and then it multiplies spectra of the data block point-wise with the kernel.-->
        <!--The kernel is padded with zeros and centered around zero frequency.-->
    <!--</li>-->
    <li>
        <b>Spatial Convolution Method:</b> The input complex interferogram is convoluted with a 2D kernel by FFT's.
        The 2D kernel is computed from 1D kernel, defined as an input parameter of the operator.

        <!--TODO: EXAMPLE-->

        The block-size for the convolution is chosen as high as possible.

        In future releases, it will be also possible to load 2D kernel from external file. Note that only odd sized
        kernels can be used, so if you want to use the kernel of odd simply add a zero to make a kernel size even.
    </li>
    <li>
        <b>Goldstein Method:</b>
        <p>The algorithm is implemented as:</p>
        <ul>
            <li> Read a data tile (T);</li>
            <li> Get a data block (B) from input tile;</li>
            <li> B = fft2d(B) (obtain complex spectrum);</li>
            <li> A = abs(B) (compute magnitude of spectrum);</li>
            <li> S = smooth(A) (perform convolution with kernel);</li>
            <li> S = S/max(S) (scale S between 0 and 1);</li>
            <li> B = B.S^alpha (weight complex spectrum);</li>
            <li> B = ifft2d(B) (result in space domain);</li>
            <li> If all blocks of tile done, write to disk.</li>

        </ul>
    </li>
</ol>
<br>
<br>
<hr>
</body>
</html>